package com.zhixun.zhlq.shiro;

import org.apache.shiro.authc.UsernamePasswordToken;

/**
 * @author eollse-wj
 * @ClassName CustomToken
 * @date 2020/3/31
 * @description
 */
public class CustomToken extends UsernamePasswordToken {

    private LoginType loginType;

    public CustomToken() {
        super();
    }

    public CustomToken(String username, String password, boolean rememberMe, String host, LoginType loginType) {
        super(username, password, rememberMe, host);
        this.loginType = loginType;
    }

    /**
     * 免密登录
     * @param username
     */
    public CustomToken(String username) {
        super(username, "", false, null);
        this.loginType = LoginType.NOPASSWORD;
    }

    /**
     * 账号密码登录
     * @param username
     * @param password
     */
    public CustomToken(String username, String password) {
        super(username, password);
        this.loginType = LoginType.PASSWORD;
    }

    public LoginType getLoginType() {
        return loginType;
    }

    public void setLoginType(LoginType loginType) {
        this.loginType = loginType;
    }
}
